package project;

import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.UIManager;


/**
 * This class is to be extended by every additional learning tools and
 * for each tool; add a line in V12.loadTools().
 * 
 * The ToolClient holds metainformation about a learning tool.
 * 
 * @author Knut
 *
 */
public abstract class ToolClient
{
	static final int PRESENTATION = 1;
	static final int CALCULATOR = 2;
	static final int MATH = 4;
	static final int LANGUAGE = 8;
	static final int FUN = 16;
	static final int TEST = 32;
	
	protected String mName = "";
	protected String mDescription = "";
	protected int mCategory = 0;
	
	protected LearningTool mTool;
	
	public ToolClient() {}
	
	/**
	 * Runs the tool and returns the panel that should be added into main frame.
	 * @return
	 */
	public abstract JPanel init();
	
	/**
	 * Stops the tool. Cannot abort the close operation, but can f.ex. save
	 * information etc.
	 */
	public abstract void stop();
	
	/**
	 * Gives the name of the tool.
	 * @return
	 */
	public String getName()
	{
		return mName;
	}
	
	/**
	 * Gives the description of the learning tool.
	 * @return
	 */
	public String getDescription()
	{
		return mDescription;
	}
	
	/**
	 * Gives the category of a learning tool.
	 * @return
	 */
	public int getCategory()
	{
		return mCategory;
	}
	
	public Icon getIcon() {
		return UIManager.getIcon("FileView.fileIcon");
	}
}